package ui;

import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;

public class MainForm extends JFrame{
	private static final long	serialVersionUID	= 1L;
	private ActionBtn redBtn;
	private JMenuBar menuBar;
	private JMenu     menu;
	
	private ActionMenuItem item;

	public MainForm() {
		super();
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setSize(1000, 500);
		setLocation(new Point(0,200));
		initComponents();
		setVisible(true);
	}
	
	private void initComponents(){
		getContentPane().setLayout(null);
		redBtn=new ActionBtn();
		redBtn.setBounds(600, 200, 100, 100);
		redBtn.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				((CommandInterface)redBtn).doAction();
				
			}
		});
		getContentPane().add(redBtn);
		//adding menue
		
		
		
		menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		
		menu = new JMenu("File");
		menuBar.add(menu);
		
		item=new ActionMenuItem("Chooser");
		item.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				((CommandInterface)item).doAction();
			}
		});
		
		menu.add(item);
		

		


		
	}

}
